a5Helper_GenerateJSONFormDefinition_From_SampleData Function

Syntax

C json = a5Helper_GenerateJSONFormDefinition_From_SampleData(C sampleJSON)

Arguments

sampleJSONCharacter

A JSON string representing a sample data record (e.g., from an API response).

Returns

jsonCharacter

The JSON definition string for the form items, with control types inferred from the sample data values.

Description

Generates a JSON Form definition based on the structure and data types of a sample JSON data object.

Discussion

This function uses "Schema-by-Example" logic. It inspects the provided JSON data to determine the appropriate control types:

Example

dim data as c = <<%json%
{
    "Product": "Widget",
    "Price": 19.95,
    "InStock": true
}
%json%

dim json as c
json = a5Helper_GenerateJSONFormDefinition_From_SampleData(data)

See Also